import request from './request'

// 系统状态相关API接口
export const systemStatusApi = {
  // 获取服务器状态
  getServerStatus: () => {
    return request.get('/api/system/status')
  },

  // 获取API监控信息
  getApiMonitor: () => {
    return request.get('/api/system/api-monitor')
  },

  // 刷新系统状态
  refreshStatus: () => {
    return request.post('/api/system/refresh')
  },

  // 重置API监控数据
  resetApiMonitorData: (hours?: number) => {
    return request.post('/api/system/api-monitor/reset', null, {
      params: hours !== undefined ? { hours } : {}
    })
  },

  // 获取CPU使用率历史数据
  getCpuHistory: (period: string = '24h') => {
    return request.get('/api/system/cpu-history', {
      params: { period }
    })
  },

  // 获取内存使用率历史数据
  getMemoryHistory: (period: string = '24h') => {
    return request.get('/api/system/memory-history', {
      params: { period }
    })
  }
}